package com.gaimall.beans.pagebean.element;

import java.util.ArrayList;
import java.util.List;

public class Detail_item_sub implements Comparable<Detail_item_sub> {

	private String name;
	private String price;
	private String sub_source;
	private List<String> price_history = new ArrayList<String>();;
	private String url;
	private String pic_url;
	private String price_trend;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPrice() {
		return price;
	}

	public void setPrice(String price) {
		this.price = price;
	}

	public String getSub_source() {
		return sub_source;
	}

	public void setSub_source(String sub_source) {
		this.sub_source = sub_source;
	}

	public List<String> getPrice_history() {
		return price_history;
	}

	public void setPrice_history(List<String> price_history) {
		this.price_history = price_history;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getPic_url() {
		return pic_url;
	}

	public void setPic_url(String pic_url) {
		this.pic_url = pic_url;
	}

	public String getPrice_trend() {
		return price_trend;
	}

	public void setPrice_trend(String price_trend) {
		this.price_trend = price_trend;
	}

	@Override
	public int compareTo(Detail_item_sub o) {

		try {
			double price_this = Double.parseDouble(this.getPrice().replace(",", ""));
			double price_o = Double.parseDouble(o.getPrice().replace(",", ""));

			if (price_this > price_o) {
				return 1;
			} else {
				return -1;
			}

		} catch (NumberFormatException nfe) {
			return 0;
		}
	}

}
